package com.np.retrofit211demo1.retrofit;

public class HttpConfig {

    public static final int HTTP_TIME_OUT_TIME = 30;
    public static final int CODE_SUCCESS = 200;

    private static final String SYSTEM_SERVICE = "service-system/";
    private static final String ULTRASOUND_SERVICE = "service-ultrasound/";
    private static final String env = "prod";    // dev|test|prod

    // 开发环境
    public static final String DEV_API_HOST = "http://192.168.2.156:6003/";
    public static final String DEV_WEBSOCKET_HOST = "ws://192.168.2.156:6003/service-ultrasound/websocket/";

    // 测试环境
    public static final String TEST_API_HOST = "http://120bs.test.firstsos.cn/";
    public static final String TEST_WEBSOCKET_HOST = "ws://120bs.test.firstsos.cn/service-ultrasound/websocket";

    // 生产环境
    public static final String PROD_API_HOST = "http://ultrasound.firstsos.cn/";
    public static final String PROD_WEBSOCKET_HOST = "wss://ultrasound.firstsos.cn/service-ultrasound/websocket/";

    private static String getApiHost() {
        //if (BuildConfig.DEBUG) {
        if (env.equals("dev")) {
            return DEV_API_HOST;
        } else if (env.equals("test")) {
            return TEST_API_HOST;
        } else {
            return PROD_API_HOST;
        }
    }

    public static String getEnv(){
        return env;
    }

    public static String getSystemApiHost() {
        return getApiHost() + SYSTEM_SERVICE;
    }

    public static String getUltraSoundApiHost() {
        return getApiHost() + ULTRASOUND_SERVICE;
    }

    public static String getWebSocketHost() {
        //if (BuildConfig.DEBUG) {
        if (env.equals("dev")) {
            return DEV_WEBSOCKET_HOST;
        } else if (env.equals("test")) {
            return TEST_WEBSOCKET_HOST;
        } else {
            return PROD_WEBSOCKET_HOST;
        }
    }
}